var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
    })(t, e);
}, function(t, e) {
    function n() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, 
    new n());
}), a = this && this.__decorate || function(t, e, n, o) {
    var r, a = arguments.length, i = a < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, n) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, n, o); else for (var s = t.length - 1; 0 <= s; s--) (r = t[s]) && (i = (a < 3 ? r(i) : 3 < a ? r(e, n, i) : r(e, n)) || i);
    return 3 < a && i && Object.defineProperty(e, n, i), i;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameData"), s = e("DataManager"), c = e("EggsManager"), l = e("UIManager"), d = e("WebManager"), u = e("Global"), p = e("PersonView"), h = cc._decorator, f = h.ccclass, g = h.property, m = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.personView = null, t.count = 0, t.total = 10, t.idx = 7, t;
    }
    return i(t, e), t.prototype.onLoad = function() {
        -1 == c.default.getInstance().checkEggGun(this.idx) ? this.init() : this.node.destroy();
    }, t.prototype.onDestroy = function() {
        cc.systemEvent.off("change_gun_skin", this.doRefresh, this);
    }, t.prototype.start = function() {}, t.prototype.init = function() {
        cc.systemEvent.on("change_gun_skin", this.doRefresh, this);
    }, t.prototype.doRefresh = function() {
        var t, e;
        this.count < this.total && (this.count++, this.count == this.total) && (d.default.getInstance().sentLog("获得武器彩蛋id:" + this.idx), 
        c.default.getInstance().updateEggGun(this.idx), (e = c.default.getInstance().getDataGun(this.idx)) && (e.time = Date.now(), 
        c.default.getInstance().setDataGun(this.idx, e)), r.GD.gunIdx = this.idx + 1e3, 
        this.personView.changeGun(r.GD.gunIdx), 0 < (e = (t = l.default.getInstance().getPnl("start")).boxs.filter(function(t) {
            return t.isEmpty();
        })).length ? (t.appendItem(r.GD.gunIdx, e[0]), t.updateMatrix()) : t.appendEquip(r.GD.gunIdx), 
        s.default.getInstance().save(), l.default.getInstance().loadPopPnl("egg_reward", {
            type: u.RewardType.ARM,
            idx: r.GD.gunIdx,
            scale: 1.6
        }), cc.systemEvent.off("change_gun_skin", this.doRefresh, this));
    }, a([ g(p.default) ], t.prototype, "personView", void 0), a([ f ], t);
}(cc.Component);

n.default = m;